mobilePickPhoto
Type
command
Summary
Displays the iPhone or Android native photo picker.
Syntax
mobilePickPhoto <source> [, <maxwidth> [, <maxheight>] ]
Description
Use the mobilePickPhoto command to allow the user to select an image.
The mobilePickPhoto displays the iPhone or Android native photo picker, allowing the user to select a photo from the device's photo library, take a photo using the device cameras or select a photo from the device's recent camera roll.
When running on an iPhone or Android, the photo-picker is displayed using the standard iOS fullscreen overlay view. The same happens when running on an iPad and the supported orientations for the app contain any of landscape right, landscape left, portrait upside down. On the contrary, when running on an iPad and the supported orientations for the app contain only portrait, then the photo-picker is displayed using a standard iOS pop-over. In this case, the pop-over is positioned relative to the rect of the target at the time the mobilePickPhoto command was called.
If the source type is not available on the target device, the command returns with result source not available. If the user cancels the pick, the command returns with result cancel. Otherwise a new image object is created on the current card of the default stack containing the chosen image.
The maxwidth and maxheight parameters constrain the maximum size of an image. The chosen image is scaled down proportionally to fit within the size specified. If either size specified is 0, then the parameter is ignored.
The image object is cloned from the templateImage, so you can use this to configure settings before calling the picker.
Android: mobilePickPhoto requires 'Camera' and 'External Storage' permissions. Set these in the standalone application settings pane. Not setting this permission will result in a "could not create temporary image file" error.
Parameters
Name | Type | Description |
---|---|---|
source | enum | The source for the image. |
maxwidth | The maximum allowed width of the image. | |
maxheight | The maximum allowed height of the image. |
Examples
mobilePickPhoto "library"
mobilePickPhoto "front camera", 250, 250
Related
keyword: templateImage
Compatibility and Support
Introduced
LiveCode 4.5.2
OS
ios
android
Platforms
mobile